package com.project.erp.action.contract.trade;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ModelDriven;
import com.project.erp.action.BaseAction;
import com.project.erp.model.contract.trade.TradeCusContract;
import com.project.erp.model.contract.trade.TradeCusContractDtl;
import com.project.erp.service.contract.trade.TradeCusContractService;

/**
 * 
 * COPYRIGHT (C) 2013 BY XXX公司

 *  功能模块名： 

 *  功能描述：

 * @author LiJiaGuo    

 * @version 1.0  

 * @created 2014-1-1 上午12:34:46
 */
@Controller
@Scope("prototype")
public class TradeCusContractDtlAction extends BaseAction implements
		ModelDriven<TradeCusContractDtl> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2939067815855643346L;
	
	private TradeCusContractDtl tradeCusContractDtl;
	@Autowired
	private TradeCusContractService tradeCusContracService;
	private TradeCusContract tradeCusContract;

	public String getTradeCusContractDtlListData() throws Exception{
		logger.debug("entry getTradeCusContractDtlListData method ...");
		try{
			tradeCusContract = tradeCusContracService.getTradeCusContractById(tradeCusContractDtl.getId());

			//设置表格返回数据
			this.getResultMap().put("rows", tradeCusContract.getTradeCusContractDtlList());
		}catch(Exception e){
			logger.error("execute getTradeCusContractDtlListData error!", e);
		}
		return SUCCESS;
	}
	
	@Override
	public TradeCusContractDtl getModel() {
		if(tradeCusContractDtl == null){
			tradeCusContractDtl = new TradeCusContractDtl();
		}
		return tradeCusContractDtl;
	}

	public TradeCusContractDtl getTradeCusContractDtl() {
		return tradeCusContractDtl;
	}

	public void setTradeCusContractDtl(TradeCusContractDtl tradeCusContractDtl) {
		this.tradeCusContractDtl = tradeCusContractDtl;
	}

}
